<template>
  <div class="user">
    <div class="user_header">
      <div class="user_header_top">
        <span v-if="token">白银会员</span>
        <span v-else></span>
        <span>个人中心</span>
        <span class="iconfont">&#xe604;</span>
      </div>
      <div class="user_header_img">
        <p v-if="token">xiaoxviao</p>
        <p v-else></p>
        <img src="../assets/imgs/user_logo.png" alt="" />
      </div>
      <div class="user_header_info">
        <ul>
          <li>
            <span v-if="token">1</span>
            <span v-else>0</span>
            <span>我的订单</span>
          </li>
          <li>
            <span v-if="token">0</span>
            <span v-else>0</span>
            <span>我的收藏</span>
          </li>
          <li>
            <span v-if="token">0</span>
            <span v-else>0</span>
            <span>我的评价</span>
          </li>
        </ul>
      </div>
    </div>
    <div class="user_next">
      <ul>
        <li>
          <span v-if="token">￥238.90元</span>
          <span v-else>0</span>
          <span>余额</span>
        </li>
        <li>
          <span v-if="token">2</span>
          <span v-else>0</span>
          <span>优惠券</span>
        </li>
        <li>
          <span v-if="token">1300</span>
          <span v-else>0</span>
          <span>积分</span>
        </li>
      </ul>
    </div>
    <div class="user_check">
      <ul>
        <li>
          <span>
            <i class="iconfont" style="background-color: #fb2c2e;">&#xe67d; </i>
            我的钱包
          </span>
          <span class="iconfont" style="float:right">查看我的钱包&#xe630;</span>
        </li>
        <li>
          <span>
            <i class="iconfont" style="background-color: #528fcc;">&#xe6ce;</i>
            全部订单</span
          >
          <span class="iconfont" style="float:right">查看订单&#xe630;</span>
        </li>
        <li>
          <span>
            <i class="iconfont" style="background-color: #fc9e03;">&#xe60b;</i>
            我的优惠券</span
          >
        </li>
        <li>
          <span>
            <i class="iconfont" style="background-color: #52cbbc;">&#xe612;</i>
            我的评价</span
          >
        </li>
        <li>
          <span>
            <i class="iconfont" style="background-color: #fb5454;">&#xe699;</i>
            我的收藏</span
          >
        </li>
        <li>
          <span>
            <i class="iconfont" style="background-color: #fa2d67;">&#xe605;</i>
            地址管理</span
          >
        </li>
        <li>
          <span>
            <i class="iconfont" style="background-color: #fdd105;">&#xe610;</i>
            我的留言</span
          >
        </li>
        <li>
          <span>
            <i class="iconfont" style="background-color: #f39800;">&#xe665;</i>
            售后服务</span
          >
        </li>
        <li>
          <span>
            <i class="iconfont" style="background-color: #fb2c2e;">&#xe62b;</i>
            申请入驻</span
          >
        </li>
        <li>
          <span v-if="token" @click="reset">
            <i class="iconfont" style="background-color: #16c533;">&#xe60a;</i>
            注销登录</span
          >
          <span v-else @click="$router.replace('/login')">
            <i class="iconfont" style="background-color: #16c533;">&#xe60a;</i>
            登录</span
          >
        </li>
      </ul>
    </div>
    <Footer :active="active"></Footer>
  </div>
</template>

<script>
import Footer from "@/components/Footer";
export default {
  components: {
    Footer
  },
  data() {
    return {
      active: 3,
      token: JSON.parse(sessionStorage.getItem("userinfo")).token
    };
  },
  methods: {
    reset() {
      sessionStorage.removeItem("userinfo");
      this.$router.push("/login");
    }
  }
};
</script>

<style lang="less" scoped>
.user {
  .user_header {
    padding: 24px 24px;
    height: 430px;
    background: url("../assets/icons/user_bg.png");
    background-size: 100%;
    .user_header_top {
      display: flex;
      justify-content: space-between;
      font-size: 32px;
      color: #ffffff;
      font-weight: 700;
    }
    .user_header_img {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      margin-top: 29px;

      p {
        font-size: 30px;
        color: #ffffff;
        font-weight: 700;
      }
      img {
        margin-top: 24px;
        width: 160px;
        height: 160px;
        z-index: 1;
      }
    }
    .user_header_info {
      margin-left: 14px;
      width: 666px;
      height: 215px;
      background-color: #ffffff;
      box-shadow: -3px 22px 31px 1px rgba(0, 0, 0, 0.07);
      transform: translateY(-80px);
      ul {
        display: flex;
        justify-content: space-around;
        transform: translateY(117px);
        li {
          color: #033333;
          font-size: 26px;
          display: flex;
          flex-direction: column;
          text-align: center;
        }
      }
    }
  }
  .user_next {
    padding: 0 24px;
    margin-top: 30px;
    margin-bottom: 20px;
    ul {
      display: flex;
      justify-content: space-around;
      li {
        display: flex;
        text-align: center;
        font-size: 24px;
        flex-direction: column;
        color: #666666;
        span:nth-child(1) {
          color: #ff4f02;
        }
      }
    }
  }
  .user_check {
    padding: 0 24px;
    margin-bottom: 110px;
    li {
      height: 52px;
      margin-bottom: 39px;
      span {
        font-size: 28px;
        font-weight: normal;
        color: #666666;
        i {
          display: inline-block;
          width: 52px;
          height: 52px;
          border-radius: 4px;
          color: #ffffff;
          text-align: center;
          line-height: 52px;
        }
      }
    }
  }
}
</style>
